package com.dmjj.dmjjxt.service.impl;

import com.dmjj.common.base.BaseMapper;
import com.dmjj.common.base.BaseServiceImpl;
import com.dmjj.dmjjxt.dao.ContractMapper;
import com.dmjj.dmjjxt.dto.ContractDTO;
import com.dmjj.dmjjxt.dto.ContractParamDTO;
import com.dmjj.dmjjxt.service.ContractService;
import com.dmjj.dmjjxt.vo.ContractParamVo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * 合同信息表业务处理接口
 * @Author zhangxue
 * @Date 2019-04-11 14:13:52
 */
@Service
public class ContractServiceImpl extends BaseServiceImpl<ContractDTO, Long> implements ContractService {

    private static final Log LOGGER = LogFactory.getLog(ContractServiceImpl.class);

    @Autowired
    private ContractMapper mapper;

    @Override
    protected BaseMapper<ContractDTO, Long> getMapper() {
        return mapper;
    }

    /**
     * 合同信息表列表
     * @Author zhangxue
     * @Date 2019-04-11 14:13:52
     * @Param
     * @Return
     */
    @Override
    public List<ContractDTO> list4Page(ContractDTO entity, Integer pageNum, Integer... pageSize) {
        return super.list4Page(entity, pageNum, pageSize);
    }

    /**
     * 合同信息表列表（无分页）
     * @Author zhangxue
     * @Date 2019-04-11 14:13:52
     * @Param
     * @Return
     */
    @Override
    public List<ContractDTO> listByCondition(ContractDTO entity) {
        return super.listByCondition(entity);
    }

    /**
     * 查询合同信息表详情信息
     * @Author zhangxue
     * @Date 2019-04-11 14:13:52
     * @Param
     * @Return
     */
    @Override
    public ContractDTO queryOneByPk(Long id) {
        return super.queryOneByPk(id);
    }

    /**
     * 保存合同信息表信息
     * @Author zhangxue
     * @Date 2019-04-11 14:13:52
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer saveContract(ContractDTO entity) {
        return mapper.saveContract(entity);
    }


    /**
     * @Author zhangxue
     * @Description //TODO 生成合同后在合同表添加合同路径
     * @Date 9:26 2019/4/15
     * @Param
     * @return
     **/
    @Override
    public Integer updateContractUrl(ContractDTO entityDTO) {
        return mapper.updateContractUrl(entityDTO);
    }


    /**
     * @Author zhangxue
     * @Description //TODO 通过合同编号查询相关信息
     * @Date 14:14 2019/4/22
     * @Param
     * @return
     **/
    @Override
    public ContractParamDTO queryContractInfosByContractNo(ContractParamVo entity) {
        return mapper.queryContractInfosByContractNo(entity);
    }

    /**
     * 删除合同信息表信息
     * @Author zhangxue
     * @Date 2019-04-11 14:13:52
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer delete(Long id) {
        return super.delete(id);
    }
}
